#include <bits/stdc++.h>

using namespace std;

const int N = 100010;

int f[N];
bool st[N];

int main()
{
    f[1] = 1;
    f[2] = 2;
    for (int i = 3; i <= 100000; ++i)
    {
        f[i] = (f[i - 1] + f[i - 2]) % 1000000;
    }

    int n;
    while (cin >> n)
    {
        if (n >= 31)
        {
            printf("%06d\n", f[n]);
        }
        else
        {
            printf("%d\n", f[n]);
        }
    }
    return 0;
}